//引入项目的所有全局组件
import SvgIcon from './SvgIcon/index.vue'
import Pagination from './Pagination/index.vue'
import Category from './category/index.vue'
//引入element-plus提供的全部图标组件
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

//把全局组件放入一个全局对象
const allGlobalComponent: any = { SvgIcon, Pagination, Category }
//向外暴露插件对象
export default {
  //必须叫做install
  install(app: any) {
    //注册所有的全局组件
    Object.keys(allGlobalComponent).forEach((key) => {
      app.component(key, allGlobalComponent[key])
    })
    //引入element-plus提供的全部图标组件注册为全局组件
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
  },
}
